
// MIT License
// 
// Copyright (c) 2009-2017 Luca Piccioni
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// 
// This file is automatically generated

#pragma warning disable 649, 1572, 1573

// ReSharper disable RedundantUsingDirective
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security;
using System.Text;

using Khronos;

// ReSharper disable CheckNamespace
// ReSharper disable InconsistentNaming
// ReSharper disable JoinDeclarationAndInitializer

namespace OpenGL
{
	public partial class Glx
	{
		/// <summary>
		/// [GLX] Value of GLX_SHARE_CONTEXT_EXT symbol.
		/// </summary>
		[RequiredByFeature("GLX_EXT_import_context")]
		public const int SHARE_CONTEXT_EXT = 0x800A;

		/// <summary>
		/// [GLX] glXGetCurrentDisplayEXT: Binding for glXGetCurrentDisplayEXT.
		/// </summary>
		[RequiredByFeature("GLX_EXT_import_context")]
		public static IntPtr GetCurrentDisplayEXT()
		{
			IntPtr retValue;

			Debug.Assert(Delegates.pglXGetCurrentDisplayEXT != null, "pglXGetCurrentDisplayEXT not implemented");
			retValue = Delegates.pglXGetCurrentDisplayEXT();
			LogCommand("glXGetCurrentDisplayEXT", retValue			);
			DebugCheckErrors(retValue);

			return (retValue);
		}

		/// <summary>
		/// [GL2.1] glXQueryContextInfoEXT: query context information
		/// </summary>
		/// <param name="dpy">
		/// Specifies the connection to the X server.
		/// </param>
		/// <param name="context">
		/// A <see cref="T:IntPtr"/>.
		/// </param>
		/// <param name="attribute">
		/// Specifies that a context parameter should be retrieved. Must be one of Glx.SHARED_CONTEXT_EXT, Glx.VISUAL_ID_EXT, or 
		/// Glx.SCREEN_EXT.
		/// </param>
		/// <param name="value">
		/// Contains the return value for <paramref name="attribute"/>.
		/// </param>
		[RequiredByFeature("GLX_EXT_import_context")]
		public static int QueryContextInfoEXT(IntPtr dpy, IntPtr context, int attribute, int[] value)
		{
			int retValue;

			unsafe {
				fixed (int* p_value = value)
				{
					Debug.Assert(Delegates.pglXQueryContextInfoEXT != null, "pglXQueryContextInfoEXT not implemented");
					retValue = Delegates.pglXQueryContextInfoEXT(dpy, context, attribute, p_value);
					LogCommand("glXQueryContextInfoEXT", retValue, dpy, context, attribute, value					);
				}
			}
			DebugCheckErrors(retValue);

			return (retValue);
		}

		/// <summary>
		/// [GL2.1] glXGetContextIDEXT: get the XID for a context.
		/// </summary>
		/// <param name="context">
		/// A <see cref="T:IntPtr"/>.
		/// </param>
		[RequiredByFeature("GLX_EXT_import_context")]
		public static IntPtr GetContextIDEXT(IntPtr context)
		{
			IntPtr retValue;

			Debug.Assert(Delegates.pglXGetContextIDEXT != null, "pglXGetContextIDEXT not implemented");
			retValue = Delegates.pglXGetContextIDEXT(context);
			LogCommand("glXGetContextIDEXT", retValue, context			);
			DebugCheckErrors(retValue);

			return (retValue);
		}

		/// <summary>
		/// [GL2.1] glXImportContextEXT: import another process's indirect rendering context.
		/// </summary>
		/// <param name="dpy">
		/// Specifies the connection to the X server.
		/// </param>
		/// <param name="contextID">
		/// Specifies a GLX rendering context.
		/// </param>
		[RequiredByFeature("GLX_EXT_import_context")]
		public static IntPtr ImportContextEXT(IntPtr dpy, IntPtr contextID)
		{
			IntPtr retValue;

			Debug.Assert(Delegates.pglXImportContextEXT != null, "pglXImportContextEXT not implemented");
			retValue = Delegates.pglXImportContextEXT(dpy, contextID);
			LogCommand("glXImportContextEXT", retValue, dpy, contextID			);
			DebugCheckErrors(retValue);

			return (retValue);
		}

		/// <summary>
		/// [GL2.1] glXFreeContextEXT: free client-side memory for imported context
		/// </summary>
		/// <param name="dpy">
		/// Specifies the connection to the X server.
		/// </param>
		/// <param name="context">
		/// A <see cref="T:IntPtr"/>.
		/// </param>
		[RequiredByFeature("GLX_EXT_import_context")]
		public static void FreeContextEXT(IntPtr dpy, IntPtr context)
		{
			Debug.Assert(Delegates.pglXFreeContextEXT != null, "pglXFreeContextEXT not implemented");
			Delegates.pglXFreeContextEXT(dpy, context);
			LogCommand("glXFreeContextEXT", null, dpy, context			);
			DebugCheckErrors(null);
		}

		internal static unsafe partial class Delegates
		{
			[RequiredByFeature("GLX_EXT_import_context")]
			[SuppressUnmanagedCodeSecurity]
			internal delegate IntPtr glXGetCurrentDisplayEXT();

			[RequiredByFeature("GLX_EXT_import_context")]
			internal static glXGetCurrentDisplayEXT pglXGetCurrentDisplayEXT;

			[RequiredByFeature("GLX_EXT_import_context")]
			[SuppressUnmanagedCodeSecurity]
			internal delegate int glXQueryContextInfoEXT(IntPtr dpy, IntPtr context, int attribute, int* value);

			[RequiredByFeature("GLX_EXT_import_context")]
			internal static glXQueryContextInfoEXT pglXQueryContextInfoEXT;

			[RequiredByFeature("GLX_EXT_import_context")]
			[SuppressUnmanagedCodeSecurity]
			internal delegate IntPtr glXGetContextIDEXT(IntPtr context);

			[RequiredByFeature("GLX_EXT_import_context")]
			internal static glXGetContextIDEXT pglXGetContextIDEXT;

			[RequiredByFeature("GLX_EXT_import_context")]
			[SuppressUnmanagedCodeSecurity]
			internal delegate IntPtr glXImportContextEXT(IntPtr dpy, IntPtr contextID);

			[RequiredByFeature("GLX_EXT_import_context")]
			internal static glXImportContextEXT pglXImportContextEXT;

			[RequiredByFeature("GLX_EXT_import_context")]
			[SuppressUnmanagedCodeSecurity]
			internal delegate void glXFreeContextEXT(IntPtr dpy, IntPtr context);

			[RequiredByFeature("GLX_EXT_import_context")]
			internal static glXFreeContextEXT pglXFreeContextEXT;

		}
	}

}
